import { createRouter, createWebHistory } from 'vue-router'
import routes from './routes'
import { useCounterStore } from '@/stores/counter'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: routes
})


router.beforeEach((to,from)=>{
  const stores= useCounterStore();

  
  if(!to.meta.isSms){
    if(!stores.token.getToken()){
      if(stores.users?.password==123456 && stores.users?.phone==16651737795){
        return true
       }else{
        console.log("错误");
        return {path:"/login"}
       }
    }
   
  }else{
    console.log("不需要验证");
    
    return true
  }
  
  return true


 
  
   
   
})

export default router
